//
//  XLocalzableTool.m
//  Bees
//
//  Created by Xiaohan on 2018/12/10.
//  Copyright © 2018 xiaohan. All rights reserved.
//

#import "XLocalzableTool.h"

@implementation XLocalzableTool

+ (void)initLocalized{
//    if (![[NSUserDefaults standardUserDefaults]objectForKey:kXAppLanguage]) {
//        NSArray *languages = [NSLocale preferredLanguages];
//        NSString *language = [languages objectOrNilAtIndex:0];
//
//        if ([language hasPrefix:kHansLanguage]) {
            //开头匹配
            [[NSUserDefaults standardUserDefaults] setObject:kHansLanguage forKey:kXAppLanguage];
//        }else{
//            [[NSUserDefaults standardUserDefaults] setObject:kEnLanguage forKey:kXAppLanguage];
//        }
//    }
}

+ (void)changeLocalzable:(NSString*)localzable{
    [[NSUserDefaults standardUserDefaults] setObject:localzable forKey:kXAppLanguage];
    kAppDelegate.mainTabBar = [MainTabBarViewController new];
    kAppDelegate.window.rootViewController = kAppDelegate.mainTabBar;
}

@end
